#pragma once
#include <iostream>

std::string opera = "+-*/%";

enum{
    Div_Zero = 1,
    Mod_Zero = 2,
    Unknown = 3
};

class Task
{
private:
    int data1_;
    int data2_;
    char op_;

    int result_;
    int exitcode_;
public:
    Task(int x,int y,char op) :data1_(x),data2_(y),op_(op),result_(0),exitcode_(0)
    {}
    Task()
    {}
    void run()
    {
       switch(op_)
       {
            case '+':
                result_ = data1_ + data2_;
                break;
            case '-':
                result_ = data1_ - data2_;
                break;
            case '/':
                if (data2_ == 0) exitcode_ = Div_Zero;
                else result_ = data1_  / data2_;
                    break;
            case '*':
                result_ = data1_ * data2_;
                break;
            case '%':
                if (data2_ == 0) exitcode_ = Mod_Zero;
                else result_ = data1_ % data2_;
                break;
            default:
                exitcode_ = Unknown;
                break;

       }
    }

    void operator()()
    {
        run();
    }

    std::string GetResult()
    {
        std::string r = std::to_string(data1_);
        r += op_;
        r += std::to_string(data2_);
        r += "=";
        r += std::to_string(result_);
        r += "[";
        r += std::to_string(exitcode_);
        r += "]";

        return r;
    }

    std::string GetTask()
    {
        std::string r = std::to_string(data1_);
        r += op_;
        r += std::to_string(data2_);
        r += "=?";

        return r;
    }

    ~Task()
    {

    }
};